home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / ObjectTcl-1.1 / otcl / OtclPart.H < prev   
Encoding:
C/C++ Source or Header  |  1995-06-29  |  5.6 KB  |  154 lines

  1. #ifndef OTCL_PART
  2. #define OTCL_PART
  3.  
  4. /*  _ __ ___ _
  5.  * | |\ /  /| |  $Id: OtclPart.H,v 1.4 1995/05/09 16:14:46 deans Exp $
  6.  * | | /  / | |  Copyright (C) 1995 IXI Limited.
  7.  * |_|/__/_\|_|  IXI Limited, Cambridge, England.
  8.  *
  9.  * Component   : OtclPart.H
  10.  *
  11.  * Author      : Dean Sheehan (deans@x.co.uk)
  12.  *  
  13.  * Description : Header file for OtclPart class, and subclasses, that manage
  14.  *               the parts of an object where each part is an instantiation
  15.  *               of an OtclClass in the inheritance hierarchy.
  16.  *
  17.  * License     :
  18.             Object Tcl License & Copyright
  19.             -----------------------------
  20.  
  21. IXI Object Tcl software, both binary and source (hereafter, Software) is copyrighted by IXI Limited (IXI), and ownership remains with IXI. 
  22.  
  23. IXI grants you (herafter, Licensee) a license to use the Software for academic, research and internal business purposes only, without a fee. Licensee may distribute the binary and source code (if required) to third parties provided that the copyright notice and this statement appears on all copies and that no charge is associated with such copies. 
  24.  
  25. Licensee may make derivative works. However, if Licensee distributes any derivative work based on or derived from the Software, then Licensee will (1) notify IXI regarding its distribution of the derivative work, and (2) clearly notify users that such derivative work is a modified version and not the original IXI Object Tcl distributed by IXI. IXI strongly recommends that Licensee provide IXI the right to incorporate such modifications into future releases of the Software under these license terms. 
  26.  
  27. Any Licensee wishing to make commercial use of the Software should contact IXI, to negotiate an appropriate license for such commercial use. Commercial use includes (1) integration of all or part of the source code into a product for sale or license by or on behalf of Licensee to third parties, or (2) distribution of the binary code or source code to third parties that need it to utilize a commercial product sold or licensed by or on behalf of Licensee. 
  28.  
  29. IXI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. IXI SHALL NOT BE LIABLE FOR ANY DAMAGES WHATSOEVER SUFFERED BY THE USERS OF THIS SOFTWARE. 
  30.  
  31. Copyright (C) 1995, IXI Limited 
  32.  
  33. By using or copying this Software, Licensee agrees to abide by the copyright law and all other applicable laws of England and the U.S., including, but not limited to, export control laws, and the terms of this license. IXI shall have the right to terminate this license immediately by written notice upon Licensee's breach of, or non-compliance with, any of its terms. Licensee may be held legally responsible for any copyright infringement that is caused or encouraged by Licensee's failure to abide by the terms of this license. 
  34.  
  35. Comments and questions are welcome and can be sent to
  36. otcl@x.co.uk 
  37.  
  38. For more information on copyright and licensing issues, contact: 
  39. Legal Department, IXI Limited, Vision Park, Cambridge CB4 4ZR,
  40. ENGLAND. 
  41.  
  42.  *
  43.  */
  44.  
  45. // Tcl Includes
  46. #include <tcl.h>
  47.  
  48. // Local Includes
  49. #include "OtclClass.H"
  50.  
  51. // Public Defines
  52. #define OTCL_PART_ATTRIBUTE_NAME "_otcl_part_"
  53.  
  54. class OtclPart
  55. {
  56. public:   // Constructor & Destructor
  57.  
  58.    OtclPart (OtclObject *owner);
  59.  
  60.    virtual ~OtclPart ();
  61.  
  62. public:   // Public Instance Methods
  63.  
  64.    virtual int discardPart (Tcl_Interp *, int fromCpp) = 0;
  65.  
  66.    virtual char *giveClassName (void) = 0;
  67.  
  68.    virtual int executeMethod (Tcl_Interp *, char *methodName, int argc,
  69.                               char *argv[], int *found) = 0;
  70.  
  71.    OtclObject *giveOwner (void);
  72.  
  73.    // Cast it to the C++ base with the specified name if
  74.    // applicable, otherwise NULL.
  75.    virtual void *toCpp (char *cppClassName) = 0;
  76.              
  77. protected:
  78.  
  79.    OtclObject *owner;
  80.  
  81. };
  82.  
  83. class OtclPartOtcl : public OtclPart
  84. {
  85. public:   // Public Constructor & Destructor
  86.  
  87.    OtclPartOtcl (Tcl_Interp *, int *result, int argc, char *argv[],
  88.                  OtclClassOtcl *otclClass, OtclObject *owner,
  89.                  OtclPart **partPtr);
  90.  
  91.    ~OtclPartOtcl ();
  92.  
  93. public:   // Public Instance Methods
  94.  
  95.    int constructParent (int parentNo, Tcl_Interp *interp, char *args);
  96.  
  97.    int instantiatePart (Tcl_Interp *, int argc, char *argv[]);
  98.  
  99.    int discardPart (Tcl_Interp *, int fromCpp);
  100.  
  101.    char *giveClassName (void);
  102.  
  103.    virtual int executeMethod (Tcl_Interp *, char *methodName, int argc,
  104.                               char *argv[], int *found);
  105.  
  106.    int executeParentMethod (Tcl_Interp *, char *parentClassName, 
  107.                             char *methodName, int argc, 
  108.                             char *argv[], int *found);
  109.  
  110.   void *toCpp (char *cppClassName);
  111.  
  112. private:  // Private Instance Methods
  113.  
  114.    int expandParentConstructorArgs (Tcl_Interp *, char *args, int *argc,
  115.                                     char **argv[]);
  116.  
  117. private:  // Private Instance Attributes
  118.  
  119.    // Place (and remove) instance attributes into top frame
  120.    void addPartScope (Tcl_Interp *);
  121.    void removePartScope (Tcl_Interp *);
  122.  
  123.    Tcl_HashTable attributes;
  124.  
  125.    OtclClassOtcl *otclc;
  126.  
  127.    OtclPart *superPart[MAX_SUPERCLASSES];
  128. };
  129.  
  130. class OtclPartCpp : public OtclPart
  131. {
  132. public:   // Constructor & Destructor
  133.  
  134.    OtclPartCpp (OtclObject *owner);
  135.  
  136.    ~OtclPartCpp ();
  137.  
  138. public:   // Public Instance Methods
  139.  
  140.    int discardPart (Tcl_Interp *, int fromCpp) = 0;
  141.  
  142.    virtual int executeMethod (Tcl_Interp *, char *methodName, int argc,
  143.                               char *argv[], int *found) = 0;
  144.  
  145.    virtual char *giveClassName (void) = 0;
  146.  
  147.    virtual void *toCpp (char *cppClassName) = 0;
  148.  
  149.    virtual void otclErrorMethod (char *mName, char *error);
  150.  
  151. };
  152.  
  153. #endif // OTCL_PART
  154.